//==============================================================================
#include "CApp.h"


//==============================================================================
bool CApp::OnInit() {
    if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        return false;
    }

    if((Surf_Display = SDL_SetVideoMode(Wx, Hx, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL) {
        return false;
    }

    if ( TTF_Init() < 0 )
    {
        printf( "Unable to init SDL_TTF: %s\n", TTF_GetError() );
        return 1;
    }

    if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) < 0) {
        return false;
    }

    if((Font = CFont::OnLoad("content/fonts/visitor2.ttf", 35)) == NULL) {
        return false;
    }

    if((Font = CFont::OnLoad("content/fonts/visitor2.ttf", 35)) == NULL) {
        return false;
    }

    SDL_WM_SetCaption("Cube Game", "Cube Game");

    SDL_EnableKeyRepeat(NULL, SDL_DEFAULT_REPEAT_INTERVAL / 3);

    CAppStateManager::SetActiveAppState(APPSTATE_INTRO);

    return true;
}

//==============================================================================
